##stringtype C
##shortstrings
/****************************************************************
   This file was created automatically by `%fv'
   from "%f0".

   Do NOT edit by hand!
****************************************************************/


#include <clib/locale_protos.h>

#ifdef AZTEC_C
#include <pragmas/locale_lib.h>
#endif /*   AZTEC_C         */

#if defined(__SASC)  ||  defined(_DCC)  ||  defined(__MAXON__)
#include <proto/exec.h>
#include <proto/locale.h>
#endif  /*  __SASC  ||  _DCC  ||  __MAXON__ */

#ifdef __GNUC__
#include <inline/locale.h>
#endif  /*  __GNUC__    */


#include "Requesters.h"

struct Library *LocaleBase;
struct Locale *locale;
static struct Catalog *Yak_Catalog = NULL;

#define Yak_Catalog_Version 20L


#if defined(CONV) || defined(PREFS)

struct FC_Type
{   LONG   ID;
    STRPTR Str;
};


char 
*getString(APTR fcstr)
{ 
  STRPTR defaultstr;
  LONG strnum;

  strnum = ((struct FC_Type *) fcstr)->ID;
  defaultstr = ((struct FC_Type *) fcstr)->Str;

  return(Yak_Catalog ? GetCatalogStr(Yak_Catalog, strnum, defaultstr) :
                      defaultstr);
}

const struct FC_Type _%i = { %d, %s };

#else

/* The wbstartup program doesn't need all the builtin strings to be
 * included into its own code because it uses only a small part of the
 * strings. So, we used an optimized definition of builtin strings.
 */


char 
*getString(APTR idstr)
{ 
    char *local;

    local = (char *)idstr + 1;
    if (LocaleBase)
        return ((char *)GetCatalogStr (Yak_Catalog, *(UBYTE *)idstr, local));
    return (local);
}


#endif

/* open locale library and catalog */
void
OpenLocaleStuff(char *language)
{
    
    if (LocaleBase = OpenLibrary("locale.library", 38L))
    {
        if (!(locale = OpenLocale(NULL)))
        {       
            PostError("No locale set!");
            CloseLibrary(LocaleBase);
            LocaleBase = NULL;
        }

        Yak_Catalog = OpenCatalog(locale, "yak.catalog", 
                                  OC_BuiltInLanguage, "english", 
                                  OC_Language, language,        
                                  OC_Version, Yak_Catalog_Version, 
                                  TAG_DONE );
    }       
}


void
CloseLocaleStuff(void)
{
    if (LocaleBase)
    {
        CloseCatalog (Yak_Catalog); 
        CloseLocale(locale);
        CloseLibrary(LocaleBase);
    }
}




